<template>
  <div>

    <div class="control-Action-page">
      <!-- aside -->
      <div class="manage-page-aside">
        <div class="head-section" style="overflow: hidden">

          <h3 class="table-head">网点指令：</h3>
          <el-select @change="organChangeEvent" v-model="organId" placeholder="请选择" value-key="item">
            <el-option v-for="item in organOptions" :key="item.id" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </div>
        <div style="display: flex;justify-content: space-between;">
          <div>
            <el-input v-model="Searchremark" @keydown.enter.native="searchEnter"
              onkeypress="if(event.keyCode == 13) return false;" placeholder="请输入名称内容" clearable
              style="width: 1.5rem; margin-right: 0.1rem"></el-input>
            <el-button type="primary" style="margin-right: 0" @click="onSearchSubmit" class="search-mr">查询</el-button>
          </div>
          <div>
            <el-button @click="handleAddAction" type="primary" plain size="medium">新增
            </el-button>
            <el-button @click="handleEditAction" type="primary" plain size="medium">编辑
            </el-button>
            <el-button @click="handleDeleteAction" type="primary" plain size="medium">删除
            </el-button>

          </div>
        </div>



        <div class="table-section" style="top: 1.05rem">
          <el-scrollbar wrap-class="scrollbar-wrapper" style="height: 100%">
            <el-table height="6.8rem" ref="refActionTable" :data="ActionTableData" border highlight-current-row
              :row-class-name="tableRowClassName" @row-click="handleCurrentChange">
              <el-table-column type="index" label="序号" width="60">
              </el-table-column>
              <el-table-column prop="groupName" label="指令名称" style="cursor: pointer">
              </el-table-column>
              <el-table-column label="是否启用" width="120">
                <template slot-scope="scope">
                  <span>{{scope.row.enable == 1?'启用':'停用'}}</span>
                </template>
              </el-table-column>
            </el-table>
          </el-scrollbar>
        </div>
      </div>
      <!-- content -->
      <div class="content manage-page-content">
        <div class="head-section">
          <header>
            <el-button @click="handleAddProbeGroup" v-if="ActionId != null" size="medium" type="primary" plain>添加
            </el-button>
            <el-button @click="handleDeleteProbeGroup" v-if="ActionId != null" size="medium" type="primary" plain>移除
            </el-button>
          </header>
          <h3 class="table-head">包含的电器</h3>
        </div>
        <div class="table-section">
          <el-scrollbar wrap-class="scrollbar-wrapper" style="height: 100%">
            <el-table :data="ProbeGroupData" ref="equipmentTable" height="7rem"
              @selection-change="handleManageAreaChange" border style="width: 100%; margin-top: 10px">
              <el-table-column type="selection" width="40"> </el-table-column>
              <el-table-column type="index" label="序号" width="50">
              </el-table-column>
              <el-table-column prop="probeName" label="名称"> </el-table-column>

            </el-table>
          </el-scrollbar>
        </div>
      </div>
    </div>


    <div>

    </div>
    <!-- 新增组弹框 -->
    <el-dialog class="same-dia" :title="isAddNew ? '新增指令组' : '编辑指令组'" :visible.sync="dialogActionVisible" width="480px"
      @close="resetForm" :close-on-click-modal="false">
      <el-form :rules="rules" class="ProbeGroup" :model="pojoProbeGroup" ref="pojoForm" label-width="95px">
        <el-form-item label="名称" prop="groupName">
          <el-input v-model="pojoProbeGroup.groupName"></el-input>
        </el-form-item>
     
      
        <!-- <el-form-item label="包含空调：" prop="remark">
          <el-radio v-model="airOperationFlag" :label="1">是</el-radio>
          <el-radio v-model="airOperationFlag" :label="2">否</el-radio>
        </el-form-item> -->
        <el-form-item label="空调模式" prop="airModel" v-show="airOperationFlag == 1">
          <el-radio-group v-model="pojoProbeGroup.airModel">
            <el-radio-button v-for="item in modeOptions" :key="item.M" :label="item.M">{{ item.name }}</el-radio-button>
          </el-radio-group>
        </el-form-item>
        <!-- <el-form-item label="空调风速" prop="airSpeed" v-show="airOperationFlag == 1">
          <el-radio-group v-model="pojoProbeGroup.airSpeed">
            <el-radio-button v-for="item in speedOptions" :key="item.W" :label="item.W">{{ item.name }}</el-radio-button>
          </el-radio-group>
        </el-form-item> -->
        <el-form-item label="空调风向" prop="airWinddirection" v-show="airOperationFlag == 1">
          <el-radio-group v-model="pojoProbeGroup.airWinddirection">
            <el-radio-button v-for="item in directionOptions" :key="item.D" :label="item.D">{{ item.name }}
            </el-radio-button>
          </el-radio-group>
        </el-form-item>
       
        
        <el-form-item label="自动调整" prop="autoAirSetting" v-show="airOperationFlag == 1">
          <el-radio v-model="pojoProbeGroup.autoAirSetting" label="1">是</el-radio>
          <el-radio v-model="pojoProbeGroup.autoAirSetting" label="0">否</el-radio>
          <el-tooltip class="item" effect="dark" content="" placement="right">
            <div slot="content">空调自动调整为设定的温度、模式且无法变更</div>
            <i class="el-icon-warning-outline" style="color: #fff;font-size: 20px;margin-left: 10px;"></i>
          </el-tooltip>
        </el-form-item>
        <el-form-item label="温度" v-show="airOperationFlag == 1" prop="temperature">
          <el-button icon="el-icon-minus" @click="handleTemperatureChange('reduce',1)" round></el-button>
          <span class="temperature-txt">{{ pojoProbeGroup.airTemperature }}℃</span>
          <el-button icon="el-icon-plus" @click="handleTemperatureChange('add',1)" round></el-button>
        </el-form-item>
        <el-form-item label="室温" v-show="airOperationFlag == 1" prop="roomTemperature">
          <el-button icon="el-icon-minus" @click="handleTemperatureChange('reduce',2)" round></el-button>
          <span class="temperature-txt">{{ pojoProbeGroup.roomTemperature }}℃</span>
          <el-button icon="el-icon-plus" @click="handleTemperatureChange('add',2)" round></el-button>
        </el-form-item>
        <el-form-item label="自动关闭" prop="autoClose" v-show="airOperationFlag == 1">
          <el-radio v-model="pojoProbeGroup.autoClose" label="1">是</el-radio>
          <el-radio v-model="pojoProbeGroup.autoClose" label="0">否</el-radio>
          <el-tooltip class="item" effect="dark" content="" placement="right">
            <div slot="content">非工作时间段内开启设备将会自动关闭</div>
            <i class="el-icon-warning-outline" style="color: #fff;font-size: 20px;margin-left: 10px;"></i>
          </el-tooltip>
        </el-form-item>
        <el-form-item label="组工作时间" prop="workType" v-show="airOperationFlag == 1">
          <el-radio v-model="pojoProbeGroup.workType" label="1">每天</el-radio>
          <el-radio v-model="pojoProbeGroup.workType" label="2">工作时段</el-radio>
          <el-tooltip class="item" effect="dark" content="" placement="right">
            <div slot="content">每天需要单独设置工作时间,工作时段则按照网点配置执行</div>
            <i class="el-icon-warning-outline" style="color: #fff;font-size: 20px;margin-left: 10px;"></i>
          </el-tooltip>
        </el-form-item>
        <el-form-item v-show="pojoProbeGroup.workType == 1" :label="`工作时间${index + 1}`" v-for="(item, index) in pojoProbeGroup.OpenTimeArr" :key="index" prop="workTime">
          <el-time-picker v-model="item.startTime" value-format="HH:mm" format="HH:mm" placeholder="选择开始日期时间">
          </el-time-picker>

          <span style="color: rgb(255, 255, 255);">~</span>
          <el-time-picker v-model="item.endTime" value-format="HH:mm" format="HH:mm" placeholder="选择结束日期时间">
          </el-time-picker>

          <span class="el-icon-remove-outline " style="color: rgb(255, 255, 255);margin-left:5px" @click="deleteItem('Optime', index)"></span>
        </el-form-item>
      
        <div class="SetTime-addBtn"  v-show="pojoProbeGroup.workType == 1" style="    text-align: center;">
          <span style="color:#fff" class="el-icon-circle-plus-outline" @click="addNew('Optime')"><font style="padding-left:10px">添加工作时间</font></span>
        </div>
        <el-form-item label="是否启用" prop="enable">
            <el-switch :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949"
              v-model="pojoProbeGroup.enable"></el-switch>
          </el-form-item>
     
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button v-if="isAddNew" type="primary" @click="addActionSubmit('pojoForm')">确 定
        </el-button>
        <el-button v-else type="primary" @click="editActionSubmit('pojoForm')">确 定
        </el-button>
        <el-button @click="dialogActionVisible = false">取 消</el-button>
      </div>
    </el-dialog>


    <!-- 添加设备 -->
    <el-dialog title="添加设备" :visible.sync="dialogAddAreaVisible" width="610px" @close="reGetUserBindAreaData"
      :close-on-click-modal="false">
      <div style="margin-bottom:10px">
        <span style="color:#fff">设备所属区域：</span>
        <el-cascader :options="AreaByOrgandata" :props="ProbeChannelProps" v-model="areaid" @change="handleChange"
          filterable clearable>
        </el-cascader>
      </div>
      <div class="prodtransfer">
        <el-transfer :render-content="renderFunc" filterable filter-placeholder="请输入设备名称" :titles="['未加入设备', '已加入设备']" v-model="proadvalue"
          :data="prodlistdata" :props=prodprops>
        </el-transfer>
      </div>
      <div slot="footer" class="dialog-footer">
        <div class="sub-can-btn-box">
          <el-button @click="submitAddManageArea" size="medium" type="primary">确 定
          </el-button>
          <el-button size="medium" @click="dialogAddAreaVisible = false">取 消
          </el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import ajax from "@/utils/ajax";
import { tableSelection, deleteConfirm } from "@/utils/elementui.js";
import axios from "axios";
export default {
  data() {
    return {
      organId: '',
      organOptions: [],
      permission: {
        add: false,
        modify: false,
        delete: false,
        bind_strategy: false,
        add_area_channel: false,
        delete_area_channel: false,
      },
      customerId: "",
      allActionTableData: [],
      ActionTableData: [],
      tableIndex: 0,
      currentAction: null,
      ActionId: null,

      isAddNew: true,
      // 新增组
      dialogActionVisible: false,
      rules: {
        groupName: [{ required: true, message: "组名称不能为空", trigger: "blur" }],
        airTemperature: [
          { required: true, message: "温度不能为空", trigger: "blur" },
        ],
      },
      pojoProbeGroup: {
        action: 1,
        organId: null,
        groupName: '',
        autoAirSetting: '1',
        airSpeed: "0",
        airTemperature: 26,
        roomTemperature:26,
        airWinddirection: "0",
        airModel: "1",
        enable:'1',
        autoClose: "1",
        workTime: '',
        workType: '1',
        OpenTimeArr: [
          { startTime: "", endTime: "" }
        ],

      },
      // 绑定指令
      dialogBandStrategy: false,
      strategyTableData: [],
      allstrategyTableData: [],
      mulStrategySelection: [],
      dialogStrategyDetali: false,
      operationTableData: [],
      // 区域和电器table
      ProbeGroupData: [],
      dialogAddAreaVisible: false,
      dialogAreaNodeCheck: [],
      multipleAreaAppSelection: [],
      Searchremark: "",
      ruleequipmenttype: 1,
      //区域
      areaData: [],
      areaid: "",
      proadvalue: [],
      prodlistdata: [],
      allprodlistdata: [],
      prodprops: {
        key: 'probeGuid',
        label: 'probeName'
      },
      renderFunc(h, option) {
          return <span title={option.probeName}>{ option.probeName}</span>;
        },
      airOperationFlag: 1,
      AreaByOrgandata: [],
      ProbeChannelProps: {
        children: 'children',
        label: 'name',
        value: 'id',
        checkStrictly: true
      },
      modeOptions: [

        {
          name: "制冷",
          M: "1",
        },

        {
          name: "制暖",
          M: "2",
        },
      ],
      speedOptions: [
        {
          name: "自动",
          W: "0",
        },
        {
          name: "1档",
          W: "1",
        },
        {
          name: "2档",
          W: "2",
        },
        {
          name: "3档",
          W: "3",
        },
      ],
      directionOptions: [
        {
          name: "自动",
          D: "0",
        },
        {
          name: "手动",
          D: "1",
        },
      ],
    };
  },

  created() {
    this.customerId = this.$store.getters.customerId;

  },
  mounted() {
    this.$store.dispatch("actions/dynamicTitleAction", this.$route.meta.title);
    this.getOrganListData();

  },

  methods: {

    // 设置可操作的权限
    setPermission() {
      let role_permissions = this.$store.getters.rolePermissions;
      console.log("-----------------------", role_permissions);
      for (let item of role_permissions) {
        if (item.action === "/web/control_Action") {
          for (let permission of item.privilegeList) {
            switch (permission.action) {
              case "/web/control_Action/add":
                this.permission.add = true;
                break;
              case "/web/control_Action/modify":
                this.permission.modify = true;
                break;
              case "/web/control_Action/delete":
                this.permission.delete = true;
                break;
              case "/web/control_Action/bind_strategy":
                this.permission.bind_strategy = true;
                break;
              case "/web/control_Action/add_area_channel":
                this.permission.add_area_channel = true;
                break;
              case "/web/control_Action/delete_area_channel":
                this.permission.delete_area_channel = true;
                break;
              default:
                break;
            }
          }
        }
      }
    },
    // 获取网点列表
    getOrganListData() {
      ajax.get({
        url: this.$API.getUserOrgan + this.$store.getters.user.id,
        success: (response) => {
          const resp = response.data;
          if (resp.length > 0) {
            this.organOptions = resp;
            this.organId = resp[0].id
            this.getActionData()
            this.getOrganProbeListData()
            this.getAreaTreeByOrganId()
          } else {
            this.organOptions = [];
          }
        },
        error: (res) => {
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },
    organChangeEvent() {
      this.getActionData()
      this.getOrganProbeListData()
      this.getAreaTreeByOrganId()
    },
    //通过晚点获取区域列表
    getAreaTreeByOrganId() {
      ajax.get({
        url: this.$API.getAreaTreeByOrganId + this.organId,
        success: (response) => {
          this.areaid = ''
          this.AreaByOrgandata = response.data;
        },
        error: (res) => {
          //console.log(res)
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },
    // 获取控制组的数据
    getActionData() {
      ajax.get({
        url: this.$API.getProbeGroupList + this.organId,
        success: (response) => {
          const resp = response.data;
          this.allActionTableData = resp;
          this.ActionTableData = resp;
          if (resp.length > 0) {
            this.$nextTick(() => {
              let index = this.tableIndex;
              this.$refs.refActionTable.setCurrentRow(
                this.$refs.refActionTable.data[index]
              );
              this.currentAction = resp[index];
              this.ActionId = resp[index].id;
              this.getProbeGroup();
            });
          } else {
            this.ProbeGroupData = [];
          }
        },
      });
    },
    //获取网点下设备
    getOrganProbeListData() {
      ajax.get({
        url: this.$API.getProbeListByOrganId + this.organId,
        success: (res) => {
          this.prodlistdata = res.data;
          this.allprodlistdata = res.data;
        },
        error: (err) => {
          // console.log(err)
          this.$message({
            message: err.message,
            type: "error",
          });
        },
      });
    },
    // 获取指令下的设备
    getProbeGroup() {
      let po_id = this.ActionId;
      ajax.get({
        url: this.$API.getgroupProbeList + po_id,
        // data: { id: po_id },
        success: (response) => {
          const resp = response.data;
          this.ProbeGroupData = resp;
          let existsprod = []
          if (this.ProbeGroupData) {
            this.ProbeGroupData.forEach(data => {
              existsprod.push(data.probeGuid)
            })
          }
          this.proadvalue = existsprod
        },
      });
    },


    // table每行加上index
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
    // 点击
    handleCurrentChange(row) {
      this.currentAction = row;
      this.ActionId = row.id;
      this.tableIndex = row.index;
      this.multipleManageActionSel = [];
      this.multipleAvailableActionSel = [];
      this.$nextTick(() => {
        this.getProbeGroup();
      });
    },

    // 新增控制组
    handleAddAction() {
      this.isAddNew = true;
      this.pojoProbeGroup.OpenTimeArr =  [
          { startTime: "", endTime: "" }
        ]
      this.dialogActionVisible = true;
    },
    addActionSubmit(formName) {
      let self =this
      this.pojoProbeGroup.organId = this.organId
     
      let wotima=[]
      let regex = /^(([0-2][0-3])|([0-1][0-9])):[0-5][0-9]$/; //正则表达式格式xx:xx 第一位为最大值为00-23 第二位00 - 59
      if(self.pojoProbeGroup.workType == 1){
      for (let i of this.pojoProbeGroup.OpenTimeArr) {
        if (i.startTime == "" || i.endTime == "") {
          self.$message({
            message: "开始或结束时间不能为空",
            type: "warning",
          });
          return;
        } else if (!regex.test(i.startTime) || !regex.test(i.endTime)) {
          self.$message({
            message: "时间错误",
            type: "warning",
          });
          return;
        }
        else {
          let attr  = `${i.startTime}-${i.endTime}`
          wotima.push(attr)
        }
    
      }
      }
     
      this.pojoProbeGroup.workTime = JSON.stringify(wotima)
      this.$refs[formName].validate((valid) => {
        if (valid) {
          ajax.post({
            url: this.$API.createProbeGroup,
            data: this.pojoProbeGroup,
            success: (response) => {
              if (response.success) {
                this.getActionData();
                this.dialogActionVisible = false;
                this.$message({
                  message: response.message,
                  type: "success",
                });
              }
            },
            error: (res) => {
              this.$message({
                message: res.message,
                type: "error",
              });
            },
          });
        }
      });
    },

    // 编辑控制组
    handleEditAction() {
      if (this.currentAction) {
        this.isAddNew = false;
        this.dialogActionVisible = true;
        this.$nextTick(() => {
          // console.log(this.currentAction)
       
          let data ={...this.currentAction}
          data.airTemperature = parseInt(data.airTemperature)
          data.roomTemperature = parseInt(data.roomTemperature==null?data.airTemperature:data.roomTemperature)
          data.OpenTimeArr=[]
          data.action=1
          data.enable=data.enable==null?'0':data.enable
          
          let OpenTimeArr = eval(data.workTime)
          if(OpenTimeArr[0] !=""){
          for(let item of OpenTimeArr){
            let attr={}
            let array = item.split("-")
            attr.startTime = array[0].replace(/"/g, '')
            attr.endTime = array[1].replace(/"/g, '')
            data.OpenTimeArr.push(attr)
          } 
        }
          // console.log( data.OpenTimeArr)

          this.pojoProbeGroup = data
        });
      } else {
        this.$message({
          message: "请先选择要编辑的指令",
          type: "warning",
        });
      }
    },
    editActionSubmit(formName) {
  let self =this
      let wotima=[]
      let regex = /^(([0-2][0-3])|([0-1][0-9])):[0-5][0-9]$/; //正则表达式格式xx:xx 第一位为最大值为00-23 第二位00 - 59
      if(self.pojoProbeGroup.workType == 1){
      for (let i of this.pojoProbeGroup.OpenTimeArr) {
        if (i.startTime == "" || i.endTime == "") {
          self.$message({
            message: "开始或结束时间不能为空",
            type: "warning",
          });
          return;
        } else if (!regex.test(i.startTime) || !regex.test(i.endTime)) {
          self.$message({
            message: "时间错误",
            type: "warning",
          });
          return;
        }
        else {
          let attr  = `${i.startTime}-${i.endTime}`
          wotima.push(attr)
        }
      
      }
      }
      this.pojoProbeGroup.workTime =  JSON.stringify(wotima)
      console.log(this.pojoProbeGroup.workTime)
      Reflect.deleteProperty(this.pojoProbeGroup,"createTime");
      this.$refs[formName].validate((valid) => {
        if (valid) {
          ajax.post({
            url: this.$API.modifyProbeGroup + this.pojoProbeGroup.id,
            data: this.pojoProbeGroup,
            success: (response) => {
              if (response.success) {
                this.getActionData();
                this.dialogActionVisible = false;
                this.$message({
                  message: response.message,
                  type: "success",
                });
              }
            },
            error: (res) => {
              this.$message({
                message: res.message,
                type: "error",
              });
            },
          });
        }
      });
    },

    // 删除组
    handleDeleteAction() {
      if (this.currentAction) {
        let ActionObj = this.currentAction;
        let po_id = ActionObj.id;
        deleteConfirm(this).then((res) => {
          if (res) {
            ajax.post({
              url: this.$API.deleteProbeGroup + po_id,
              success: (response) => {
                if (response.success) {
                  this.tableIndex = 0;
                  this.getActionData();
                  this.$message({
                    message: response.message,
                    type: "success",
                  });
                }
              },
              error: (response) => {
                this.$message({
                  message: response.message,
                  type: "error",
                });
              },
            });
          }
        });
      } else {
        this.$message({
          message: "请先选择要删除的组",
          type: "warning",
        });
      }
    },








    // 添加电器弹窗
    handleAddProbeGroup() {
      this.dialogAddAreaVisible = true;
      this.checkList = [];
    },



    submitAddManageArea() {

      let self = this
      if (this.proadvalue.length == 0) {
        this.$message({
          message: "请先选择探头",
          type: "warning",
        });
        return;
      }
      // console.log(this.proadvalue)
      axios
        .post(this.$API.ProbeGroupAddProbe + this.ActionId, this.proadvalue)
        .then(function (res) {
          if (res.data.success) {
            self.$message({
              message: "新增成功",
              type: "success",
            });
            self.dialogAddAreaVisible = false;
          }
        });

    },

    // 重新获取绑定区域的数据
    reGetUserBindAreaData() {
      if (this.ActionId != null) {
        this.getProbeGroup();
      }
    },

    // 移除包含的区域和电器
    handleManageAreaChange(value) {
      this.multipleAreaAppSelection = value;
    },
    handleDeleteProbeGroup() {
      let po_id = this.ActionId;
      let self = this
      let selectionArr = this.multipleAreaAppSelection;
      let selResult = tableSelection(selectionArr, 0);
      // console.log(selectionArr)
      if (selResult) {
        deleteConfirm(this).then((res) => {
          if (res) {
            let idsArr = [];
            for (let item of selectionArr) {
              idsArr.push(item.probeGuid);
            }
            // let ids = idsArr.join(",");
            let ids = idsArr;
            axios
              .post(this.$API.ProbeGroupDelProbe, ids)
              .then(function (res) {
                if (res.data.success) {
                  self.getProbeGroup();
                  self.$message({
                    type: "success",
                    message: res.data.message,
                  });
                }
              });

          }
        });
      }
    },
    handleChange(value) {
      let data = [...this.allprodlistdata]
      let areaid
      if (value != 0) {
        areaid = value.slice(-1)[0]
        this.prodlistdata = data.filter((data) => data.areaId == areaid)

      }
      else {
        this.areaid = ''
        this.prodlistdata = data
      }
    },

    // 重置表单
    resetForm() {
      Reflect.deleteProperty(this.pojoProbeGroup,"createTime");
      this.$refs["pojoForm"].resetFields();
    },

    onSearchSubmit() {
      this.ActionTableData = [...this.allActionTableData];
      this.ActionTableData = this.ActionTableData.filter((data) =>
        data.name.includes(this.Searchremark)
      );
    },
    searchEnter(e) {
      let keyCode = e.keyCode;
      if (keyCode == 13) {
        this.onSearchSubmit();
      }
    },
    addNew(timeType) {
      let self = this;
      switch (timeType) {
        case "Optime":
        this.$nextTick(() => {
          self.pojoProbeGroup.OpenTimeArr.push({ startTime: "", endTime: "" });
        })
          break;

      }
    },
    deleteItem(timeType, itemIndex) {
      let self = this;
      switch (timeType) {
        case "Optime":
        this.$nextTick(() => {
          self.pojoProbeGroup.OpenTimeArr.splice(itemIndex, 1);
        })
          break;

      }
    },
    handleTemperatureChange(changeType,type) {
      let temperatureNumber = type==1?parseInt(this.pojoProbeGroup.airTemperature):parseInt(this.pojoProbeGroup.roomTemperature);
      if (changeType == "add") {
        temperatureNumber = temperatureNumber + 1;
      } else {
        temperatureNumber = temperatureNumber - 1;
      }
      if(type==1){
      // 判断温度范围
        if (temperatureNumber > 31) {
          this.$message({
            message: "温度已经达到最高",
            type: "warning",
          });
          return;
        } else if (temperatureNumber < 16) {
          this.$message({
            message: "温度已经达到最低",
            type: "warning",
          });
          return;
        }
        this.pojoProbeGroup.airTemperature = temperatureNumber;
      }
      if(type==2){
      this.pojoProbeGroup.roomTemperature = temperatureNumber;
      }
    },
  },
};
</script>

<style lang="stylus" scoped>
.ruleequipment-tab-title-row {
  height: 0.5rem;
  background-color: #0d2c5a;
  border-bottom: solid 0.01rem #0d235a;
  -webkit-box-shadow: inset 0px 5px 20px 0px rgba(80, 160, 191, 0.5);
  box-shadow: inset 0px 5px 20px 0px rgba(80, 160, 191, 0.5);
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin-bottom: 0.1rem;

  div {
    width: 2rem;
    height: 0.44rem;
    line-height: 0.44rem;
    margin-left: 0.08rem !important;
    border-radius: 5px 5px 0px 0px;
    border: solid 1px #0d235a !important;
    border-bottom: 0 !important;
    margin-top: 0.06rem !important;
    color: #fff !important;
    font-size: 0.16rem !important;
    padding: 0 20px;
    display: inline-block;
    box-sizing: border-box;
    cursor: pointer;
  }

  .ruleequipmenttype_on {
    background-color: #16214d !important;
    color: #fff !important;
  }
}

>>> {
  .control-Action-page {
    position: absolute;
    top: 0.5rem;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.2rem;
    overflow: auto;

      .head-section {
        .table-head {
          /* margin-top 0.2rem */
          height: 0.43rem;
          line-height: 0.43rem;
          font-size: 0.16rem;
          font-weight: normal;
          float: left;
        }

        header {
          float: right;
        }
      
    }

    .table-section {
      position: absolute;
      top: 0.72rem;
      left: 0.2rem;
      right: 0.2rem;
      bottom: 0.2rem;
    }

    .content {
      .content-head {
        text-align: right;
      }

      .area-table-section {
        position: absolute;
        top: 0.66rem;
        left: 0.2rem;
        right: 0.2rem;
        bottom: 0.2rem;
      }
    }
  }

  .dialog-left {
    .table-head {
      height: 0.3rem;
      margin-top: 0.2rem;
      font-size: 0.16rem;
      font-weight: normal;
    }

    .table-section {
      position: absolute;
      top: 1.2rem;
      left: 0.2rem;
      right: 0.2rem;
      bottom: 0.2rem;
    }

    .dia-table-section {
      height: 300px;
    }
  }

  .el-table__body tr {
    cursor: pointer;
  }

  .el-table--striped .el-table__body tr.el-table__row--striped.current-row td, .el-table__body tr.current-row > td {
    color: #fff;
    background-color: rgba(68, 199, 244, 0.2) !important;
  }

  .el-table__body-wrapper {
    overflow-y: auto !important;
  }

  .el-table .el-checkbox__label {
    color: #fff;
  }

  .el-button.is-round {
    padding: 3px 6px;
  }

  .temperature-txt {
    padding: 0 0.1rem;
    font-size: 0.16rem;
    color: #fff;
  }

  .el-select--mini {
    width: 60px;

    .el-input--suffix .el-input__inner {
      padding-right: 20px;
      padding-left: 10px;
    }
  }

  .air-table-item {
    margin-right: 0.1rem;
  }

  .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner, .el-radio__input.is-disabled.is-checked .el-radio__inner {
    background: #409EFF;
  }

  .el-button {
    padding: 0.12rem 0.16rem;
  }

  .el-dialog__footer {
    padding-top: 0;
    padding-bottom: 0.3rem;
  }

  .el-form-item:last-child {
    margin-bottom: 0 !important;
  }

  .area-add {
    width: 380px;
    margin: 0 auto;

    .el-select {
      width: 300px;
    }
  }
}

.equipment-title {
  display: flex;
  margin-bottom: 10px;
}

>>>.equipment-title .el-checkbox__label {
  color: #fff;
}

>>>.equipment-title .el-checkbox {
  min-width: 81px;
  margin-right: 10px;
}

.working-hours-container {
  position: absolute;
  top: 0.5rem;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.2rem;
  overflow: auto;
  background-color: $pageBg;
}

.e-t-r-equipment-row {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 7rem;
  padding: 0.2rem;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  background: #16214d;
  overflow: auto;
}
.e-t-r-equipment-row {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 7rem;
  padding: 0.2rem;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  background: #16214d;
  overflow: auto;
}

.e-t-r-rule-row {
  position: absolute;
  left: 7rem;
  right: 0;
  top: 0;
  bottom: 0;
  padding: 0.19rem 0.2rem;
  overflow: auto;
  background: #202c5f;
}

>>>.el-table--striped .el-table__body tr.el-table__row--striped.current-row td, >>>.el-table__body tr.current-row > td {
  color: #fff;
  background-color: rgba(68, 199, 244, 0.2) !important;
}

.e-t-r-rule-box {
  display: flex;
}

.left, .right {
  width: 360px;
  height: 8.1rem;
  padding: 10px;
  border: 1px solid #fff;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.dialog-Action-btn {
  width: 200px;
  padding: 0.2rem;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.dialog-Action-btn .el-button {
  display: block;
  margin: 0.2rem auto;
}
.dialogrule_worktype .el-radio {
    margin-bottom: 10px;
}
>>>.el-dialog .prodtransfer input {
    color: #000;
}
>>>.el-date-editor.el-input{
  width: 120px;
}
>>>.ProbeGroup .el-form-item{
  margin-bottom: 9px;
}

@media screen and (max-width: 1440px){
>>>.manage-page-aside .el-input__inner {
    height: 0.34rem;
  }
>>>.manage-page-aside .el-button{
    padding: 0.09rem 0.15rem;
    font-size: 0.14rem;
}
.manage-page-aside .el-button+.el-button {
    margin-left: 0.1rem;
}
}
</style>
